<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Convert a variant into a new variant object of another type</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.variant-cast" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">variant_cast</h1>
  <p class="verinfo">(PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">variant_cast</span> &mdash; <span class="dc-title">Convert a variant into a new variant object of another type</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.variant-cast-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>variant_cast</strong></span>
    ( <span class="methodparam"><span class="type"><a href="class.variant.html" class="type variant">variant</a></span> <code class="parameter">$variant</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$type</code></span>
   ) : <span class="type"><a href="class.variant.html" class="type variant">variant</a></span></div>

  <p class="para rdfs-comment">
   This function makes a copy of <code class="parameter">variant</code> and then
   performs a variant cast operation to force the copy to have the type
   given by <code class="parameter">type</code>.
  </p>
  <p class="para">
   This function wraps VariantChangeType() in the COM library; consult MSDN
   for more information.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.variant-cast-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">variant</code></dt>

     <dd>

      <p class="para">
       The variant.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">type</code></dt>

     <dd>

      <p class="para">
       <code class="parameter">type</code> should be one of the
       <strong><code>VT_XXX</code></strong> constants.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.variant-cast-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns a variant of given <code class="parameter">type</code>.
  </p>
 </div>

 <div class="refsect1 seealso" id="refsect1-function.variant-cast-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="variant_set_type.html" class="function" rel="rdfs-seeAlso">variant_set_type()</a> - Convert a variant into another type &quot;in-place&quot;</span></li>
   </ul>
  </p>
 </div>

</div></div></div></body></html>